package com.mufeng.mflibs.utils

import android.app.Application
import android.content.Context
import android.content.ContextWrapper
import android.widget.Toast

private class GlobalContext(context: Context) : ContextWrapper(context)

private lateinit var sApplication: Application
private lateinit var sGlobalContext: GlobalContext

fun initContext(application: Application) {
    if (!::sApplication.isInitialized) {
        sApplication = application
    }
    if (!::sGlobalContext.isInitialized) {
        sGlobalContext =
            GlobalContext(application.applicationContext)
    }
}

val context: Context
    get() = sGlobalContext


val application: Application
    get() = sApplication

